
<div class="toplink"><img src="/images/iconhome.gif" /><a href="#"><b>[Trang chủ]</b></a>&raquo;<a href="#" class="pagehere">[Văn bản luật]</a></div>
<div class="help_left" >
    <div class="hd_top"><span></span></div>
    <div class="hd_bg">
    <table cellspacing="3" cellpadding="2" border="0" width="100%">
        <?php 
        $arrdocCate= listAllCategory($parent_id = 0);
         for($i=0;$i<count($arrdocCate);$i++)
            {
            ?>
            <tr>
                <td class="catdownload"><?php echo htmlentities_utf8($arrdocCate[$i]["cat_title"]);?></td>
                </tr>
                <tr>
                    <td>
                        <table cellspacing="5" cellpadding="5" border="0" width="100%" class="listdoc" >
                            <?php $rsDocs=getDocsByCat($arrdocCate[$i]["cat_id"]);
                            $arrDocs = array();
                            while($row=$db->fetch_array($rsDocs)){
                                $arrDocs['id'][] = $row['id'];
                                $arrDocs['title'][] = $row['title'];
                                $arrDocs['filename'][] = $row['filename'];
                            }
                            for($j=0;$j<count($arrDocs['title']);$j=$j+2)
                            {
                                $arrTenFile1 = explode('.',basename($arrDocs['filename'][$j]));
                                $arrTenFile2 = explode('.',basename($arrDocs['filename'][$j+1]));                                
                            ?>
                        <tr>
                            <td width="40%" >
                                <img src="<?php echo SITE_IMAGES_URL.'/';?><?php
                                     switch(strtolower($arrTenFile1[1]))
                                     {
                                         case 'pdf':{echo 'pdf_icon.gif';break;}
                                         case 'doc':{echo 'doc_icon.gif';break;}
                                         case 'docx':{echo 'doc_icon.gif';break;}
                                         case 'xls':{echo 'excel_icon.gif';break;}
                                         default:{echo 'file_icon.gif';break;}
                                     }
                                     ?>" width="20px" height="20px" style="margin-right: 10px;margin-bottom: -2px"><a href="<?php echo SITE_URL.'/download.php?i='. $arrDocs['id'][$j].'&c='.$arrTenFile1[0];?>"><?php echo $arrDocs["title"][$j];?></a>
                            </td>

                            <td width="40%" >
                                <?php if($arrDocs['id'][$j+1]>0)
                                {
                                ?>
                                <img src="<?php echo SITE_IMAGES_URL.'/';?><?php
                                     switch(strtolower($arrTenFile2[1]))
                                     {
                                         case 'pdf':{echo 'pdf_icon.gif';break;}
                                         case 'doc':{echo 'doc_icon.gif';break;}
                                         case 'docx':{echo 'doc_icon.gif';break;}
                                         case 'xls':{echo 'excel_icon.gif';break;}
                                         default:{echo 'file_icon.gif';break;}
                                     }
                                     ?>" width="20px" height="20px" style="margin-right: 10px;margin-bottom: -2px"><a href="<?php echo SITE_URL.'/download.php?i='. $arrDocs['id'][$j+1].'&c='.$arrTenFile2[0];?>"><?php echo $arrDocs["title"][$j+1];?></a>
                                <? }?>
                            </td>

                        </tr>
                        <?php } ?>
                    </table>
                    </td>
                </tr>
                <?php }
                ?>
    </table>
    </div>
    <div class="hd_bt"><span></span></div>
</div>
